<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qmovie.cpp -->
  <title>QMovie Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QMovie</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#public-slots">Public Slots</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QMovie Class</h1>
<!-- $$$QMovie-brief -->
<p>The QMovie class is a convenience class for playing movies with <a href="qimagereader.html">QImageReader</a>. <a href="#details">More...</a></p>
<!-- @@@QMovie -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QMovie&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qobject.html">QObject</a></td></tr></table></div><ul>
<li><a href="qmovie-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#CacheMode-enum">CacheMode</a></b> { CacheNone, CacheAll }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#MovieState-enum">MovieState</a></b> { NotRunning, Paused, Running }</td></tr>
</table></div>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qmovie.html#cacheMode-prop">cacheMode</a></b> : CacheMode</li>
<li class="fn"><b><a href="qmovie.html#speed-prop">speed</a></b> : int</li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#QMovie-2">QMovie</a></b>(const QString &amp;<i>fileName</i>, const QByteArray &amp;<i>format</i> = QByteArray(), QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#QMovie-1">QMovie</a></b>(QIODevice *<i>device</i>, const QByteArray &amp;<i>format</i> = QByteArray(), QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#QMovie">QMovie</a></b>(QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#dtor.QMovie">~QMovie</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QColor </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#backgroundColor">backgroundColor</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMovie::CacheMode </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#cacheMode-prop">cacheMode</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#currentFrameNumber">currentFrameNumber</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImage </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#currentImage">currentImage</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPixmap </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#currentPixmap">currentPixmap</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIODevice *</td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#device">device</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#fileName">fileName</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#format">format</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#frameCount">frameCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#frameRect">frameRect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#isValid">isValid</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#jumpToFrame">jumpToFrame</a></b>(int <i>frameNumber</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QImageReader::ImageReaderError </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#lastError">lastError</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#lastErrorString">lastErrorString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#loopCount">loopCount</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#nextFrameDelay">nextFrameDelay</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#scaledSize">scaledSize</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#setBackgroundColor">setBackgroundColor</a></b>(const QColor &amp;<i>color</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#cacheMode-prop">setCacheMode</a></b>(QMovie::CacheMode <i>mode</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#setDevice">setDevice</a></b>(QIODevice *<i>device</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#setFileName">setFileName</a></b>(const QString &amp;<i>fileName</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#setFormat">setFormat</a></b>(const QByteArray &amp;<i>format</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#setScaledSize">setScaledSize</a></b>(const QSize &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#speed-prop">speed</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QMovie::MovieState </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#state">state</a></b>() const</td></tr>
</table></div>
<a name="public-slots"></a>
<h2 id="public-slots">Public Slots</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#jumpToNextFrame">jumpToNextFrame</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#setPaused">setPaused</a></b>(bool <i>paused</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#speed-prop">setSpeed</a></b>(int <i>percentSpeed</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#start">start</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#stop">stop</a></b>()</td></tr>
</table></div>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#error">error</a></b>(QImageReader::ImageReaderError <i>error</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#finished">finished</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#frameChanged">frameChanged</a></b>(int <i>frameNumber</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#resized">resized</a></b>(const QSize &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#started">started</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#stateChanged">stateChanged</a></b>(QMovie::MovieState <i>state</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#updated">updated</a></b>(const QRect &amp;<i>rect</i>)</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QByteArray&gt; </td><td class="memItemRight bottomAlign"><b><a href="qmovie.html#supportedFormats">supportedFormats</a></b>()</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QMovie-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>This class is used to show simple animations without sound. If you want to display video and media content, use the <a href="../qtmultimedia/qtmultimedia-index.html">Qt Multimedia</a> multimedia framework instead.</p>
<p>First, create a QMovie object by passing either the name of a file or a pointer to a <a href="../qtcore/qiodevice.html">QIODevice</a> containing an animated image format to QMovie's constructor. You can call <a href="qmovie.html#isValid">isValid</a>() to check if the image data is valid, before starting the movie. To start the movie, call <a href="qmovie.html#start">start</a>(). QMovie will enter <a href="qmovie.html#MovieState-enum">Running</a> state, and emit <a href="qmovie.html#started">started</a>() and <a href="qmovie.html#stateChanged">stateChanged</a>(). To get the current state of the movie, call <a href="qmovie.html#state">state</a>().</p>
<p>To display the movie in your application, you can pass your QMovie object to <a href="../qtwidgets/qlabel.html#setMovie">QLabel::setMovie</a>(). Example:</p>
<pre class="cpp">

  <span class="type"><a href="../qtwidgets/qlabel.html">QLabel</a></span> label;
  <span class="type"><a href="qmovie.html#QMovie">QMovie</a></span> <span class="operator">*</span>movie <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qmovie.html#QMovie">QMovie</a></span>(<span class="string">&quot;animations/fire.gif&quot;</span>);

  label<span class="operator">.</span>setMovie(movie);
  movie<span class="operator">-</span><span class="operator">&gt;</span>start();

</pre>
<p>Whenever a new frame is available in the movie, QMovie will emit <a href="qmovie.html#updated">updated</a>(). If the size of the frame changes, <a href="qmovie.html#resized">resized</a>() is emitted. You can call <a href="qmovie.html#currentImage">currentImage</a>() or <a href="qmovie.html#currentPixmap">currentPixmap</a>() to get a copy of the current frame. When the movie is done, QMovie emits <a href="qmovie.html#finished">finished</a>(). If any error occurs during playback (i.e, the image file is corrupt), QMovie will emit <a href="qmovie.html#error">error</a>().</p>
<p>You can control the speed of the movie playback by calling <a href="qmovie.html#speed-prop">setSpeed</a>(), which takes the percentage of the original speed as an argument. Pause the movie by calling <a href="qmovie.html#setPaused">setPaused</a>(true). QMovie will then enter <a href="qmovie.html#MovieState-enum">Paused</a> state and emit <a href="qmovie.html#stateChanged">stateChanged</a>(). If you call <a href="qmovie.html#setPaused">setPaused</a>(false), QMovie will reenter <a href="qmovie.html#MovieState-enum">Running</a> state and start the movie again. To stop the movie, call <a href="qmovie.html#stop">stop</a>().</p>
<p>Certain animation formats allow you to set the background color. You can call <a href="qmovie.html#setBackgroundColor">setBackgroundColor</a>() to set the color, or <a href="qmovie.html#backgroundColor">backgroundColor</a>() to retrieve the current background color.</p>
<p><a href="qmovie.html#currentFrameNumber">currentFrameNumber</a>() returns the sequence number of the current frame. The first frame in the animation has the sequence number 0. <a href="qmovie.html#frameCount">frameCount</a>() returns the total number of frames in the animation, if the image format supports this. You can call <a href="qmovie.html#loopCount">loopCount</a>() to get the number of times the movie should loop before finishing. <a href="qmovie.html#nextFrameDelay">nextFrameDelay</a>() returns the number of milliseconds the current frame should be displayed.</p>
<p>QMovie can be instructed to cache frames of an animation by calling <a href="qmovie.html#cacheMode-prop">setCacheMode</a>().</p>
<p>Call <a href="qmovie.html#supportedFormats">supportedFormats</a>() for a list of formats that QMovie supports.</p>
</div>
<p><b>See also </b><a href="../qtwidgets/qlabel.html">QLabel</a>, <a href="qimagereader.html">QImageReader</a>, and <a href="../qtwidgets/qtwidgets-widgets-movie-example.html">Movie Example</a>.</p>
<!-- @@@QMovie -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$CacheMode$$$CacheNone$$$CacheAll -->
<h3 class="fn" id="CacheMode-enum"><a name="CacheMode-enum"></a>enum QMovie::<span class="name">CacheMode</span></h3>
<p>This enum describes the different cache modes of <a href="qmovie.html">QMovie</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QMovie::CacheNone</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No frames are cached (the default).</td></tr>
<tr><td class="topAlign"><code>QMovie::CacheAll</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">All frames are cached.</td></tr>
</table></div>
<!-- @@@CacheMode -->
<!-- $$$MovieState$$$NotRunning$$$Paused$$$Running -->
<h3 class="fn" id="MovieState-enum"><a name="MovieState-enum"></a>enum QMovie::<span class="name">MovieState</span></h3>
<p>This enum describes the different states of <a href="qmovie.html">QMovie</a>.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QMovie::NotRunning</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The movie is not running. This is <a href="qmovie.html">QMovie</a>'s initial state, and the state it enters after <a href="qmovie.html#stop">stop</a>() has been called or the movie is finished.</td></tr>
<tr><td class="topAlign"><code>QMovie::Paused</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The movie is paused, and <a href="qmovie.html">QMovie</a> stops emitting <a href="qmovie.html#updated">updated</a>() or <a href="qmovie.html#resized">resized</a>(). This state is entered after calling pause() or <a href="qmovie.html#setPaused">setPaused</a>(true). The current frame number it kept, and the movie will continue with the next frame when unpause() or <a href="qmovie.html#setPaused">setPaused</a>(false) is called.</td></tr>
<tr><td class="topAlign"><code>QMovie::Running</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The movie is running.</td></tr>
</table></div>
<!-- @@@MovieState -->
</div>
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$cacheMode-prop$$$cacheMode$$$setCacheModeQMovie::CacheMode -->
<h3 class="fn" id="cacheMode-prop"><a name="cacheMode-prop"></a><span class="name">cacheMode</span> : <span class="type"><a href="qmovie.html#CacheMode-enum">CacheMode</a></span></h3>
<p>This property holds the movie's cache mode</p>
<p>Caching frames can be useful when the underlying animation format handler that <a href="qmovie.html">QMovie</a> relies on to decode the animation data does not support jumping to particular frames in the animation, or even &quot;rewinding&quot; the animation to the beginning (for looping). Furthermore, if the image data comes from a sequential device, it is not possible for the underlying animation handler to seek back to frames whose data has already been read (making looping altogether impossible).</p>
<p>To aid in such situations, a <a href="qmovie.html">QMovie</a> object can be instructed to cache the frames, at the added memory cost of keeping the frames in memory for the lifetime of the object.</p>
<p>By default, this property is set to <a href="qmovie.html#CacheMode-enum">CacheNone</a>.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> QMovie::CacheMode </td><td class="memItemRight bottomAlign"><span class="name"><b>cacheMode</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setCacheMode</b></span>(QMovie::CacheMode <i>mode</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qmovie.html#CacheMode-enum">QMovie::CacheMode</a>.</p>
<!-- @@@cacheMode -->
<!-- $$$speed-prop$$$speed$$$setSpeedint -->
<h3 class="fn" id="speed-prop"><a name="speed-prop"></a><span class="name">speed</span> : <span class="type">int</span></h3>
<p>This property holds the movie's speed</p>
<p>The speed is measured in percentage of the original movie speed. The default speed is 100%. Example:</p>
<pre class="cpp">

  <span class="type"><a href="qmovie.html#QMovie">QMovie</a></span> movie(<span class="string">&quot;racecar.gif&quot;</span>);
  movie<span class="operator">.</span>setSpeed(<span class="number">200</span>); <span class="comment">// 2x speed</span>

</pre>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>speed</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSpeed</b></span>(int <i>percentSpeed</i>)</td></tr>
</table></div>
<!-- @@@speed -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QMovie$$$QMovieconstQString&constQByteArray&QObject* -->
<h3 class="fn" id="QMovie-2"><a name="QMovie-2"></a>QMovie::<span class="name">QMovie</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>fileName</i>, const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>format</i> = QByteArray(), <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a QMovie object. QMovie will use read image data from <i>fileName</i>. If <i>format</i> is not empty, QMovie will use the image format <i>format</i> for decoding the image data. Otherwise, QMovie will attempt to guess the format.</p>
<p>The <i>parent</i> object is passed to <a href="../qtcore/qobject.html">QObject</a>'s constructor.</p>
<!-- @@@QMovie -->
<!-- $$$QMovie$$$QMovieQIODevice*constQByteArray&QObject* -->
<h3 class="fn" id="QMovie-1"><a name="QMovie-1"></a>QMovie::<span class="name">QMovie</span>(<span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *<i>device</i>, const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>format</i> = QByteArray(), <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a QMovie object. QMovie will use read image data from <i>device</i>, which it assumes is open and readable. If <i>format</i> is not empty, QMovie will use the image format <i>format</i> for decoding the image data. Otherwise, QMovie will attempt to guess the format.</p>
<p>The <i>parent</i> object is passed to <a href="../qtcore/qobject.html">QObject</a>'s constructor.</p>
<!-- @@@QMovie -->
<!-- $$$QMovie[overload1]$$$QMovieQObject* -->
<h3 class="fn" id="QMovie"><a name="QMovie"></a>QMovie::<span class="name">QMovie</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a QMovie object, passing the <i>parent</i> object to <a href="../qtcore/qobject.html">QObject</a>'s constructor.</p>
<p><b>See also </b><a href="qmovie.html#setFileName">setFileName</a>(), <a href="qmovie.html#setDevice">setDevice</a>(), and <a href="qmovie.html#setFormat">setFormat</a>().</p>
<!-- @@@QMovie -->
<!-- $$$error[overload1]$$$errorQImageReader::ImageReaderError -->
<h3 class="fn" id="error"><a name="error"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">error</span>(<span class="type"><a href="qimagereader.html#ImageReaderError-enum">QImageReader::ImageReaderError</a></span> <i>error</i>)</h3>
<p>This signal is emitted by <a href="qmovie.html">QMovie</a> when the error <i>error</i> occurred during playback. <a href="qmovie.html">QMovie</a> will stop the movie, and enter <a href="qmovie.html#MovieState-enum">QMovie::NotRunning</a> state.</p>
<p><b>See also </b><a href="qmovie.html#lastError">lastError</a>() and <a href="qmovie.html#lastErrorString">lastErrorString</a>().</p>
<!-- @@@error -->
<!-- $$$finished[overload1]$$$finished -->
<h3 class="fn" id="finished"><a name="finished"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">finished</span>()</h3>
<p>This signal is emitted when the movie has finished.</p>
<p><b>See also </b><a href="qmovie.html#stop">QMovie::stop</a>().</p>
<!-- @@@finished -->
<!-- $$$frameChanged[overload1]$$$frameChangedint -->
<h3 class="fn" id="frameChanged"><a name="frameChanged"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">frameChanged</span>(<span class="type">int</span> <i>frameNumber</i>)</h3>
<p>This signal is emitted when the frame number has changed to <i>frameNumber</i>. You can call <a href="qmovie.html#currentImage">currentImage</a>() or <a href="qmovie.html#currentPixmap">currentPixmap</a>() to get a copy of the frame.</p>
<p>This function was introduced in Qt 4.1.</p>
<!-- @@@frameChanged -->
<!-- $$$jumpToNextFrame[overload1]$$$jumpToNextFrame -->
<h3 class="fn" id="jumpToNextFrame"><a name="jumpToNextFrame"></a><code>[slot] </code><span class="type">bool</span> QMovie::<span class="name">jumpToNextFrame</span>()</h3>
<p>Jumps to the next frame. Returns <code>true</code> on success; otherwise returns <code>false</code>.</p>
<!-- @@@jumpToNextFrame -->
<!-- $$$resized[overload1]$$$resizedconstQSize& -->
<h3 class="fn" id="resized"><a name="resized"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">resized</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &amp;<i>size</i>)</h3>
<p>This signal is emitted when the current frame has been resized to <i>size</i>. This effect is sometimes used in animations as an alternative to replacing the frame. You can call <a href="qmovie.html#currentImage">currentImage</a>() or <a href="qmovie.html#currentPixmap">currentPixmap</a>() to get a copy of the updated frame.</p>
<!-- @@@resized -->
<!-- $$$setPaused[overload1]$$$setPausedbool -->
<h3 class="fn" id="setPaused"><a name="setPaused"></a><code>[slot] </code><span class="type">void</span> QMovie::<span class="name">setPaused</span>(<span class="type">bool</span> <i>paused</i>)</h3>
<p>If <i>paused</i> is true, <a href="qmovie.html">QMovie</a> will enter <a href="qmovie.html#MovieState-enum">Paused</a> state and emit <a href="qmovie.html#stateChanged">stateChanged</a>(Paused); otherwise it will enter <a href="qmovie.html#MovieState-enum">Running</a> state and emit <a href="qmovie.html#stateChanged">stateChanged</a>(Running).</p>
<p><b>See also </b><a href="qmovie.html#state">state</a>().</p>
<!-- @@@setPaused -->
<!-- $$$start[overload1]$$$start -->
<h3 class="fn" id="start"><a name="start"></a><code>[slot] </code><span class="type">void</span> QMovie::<span class="name">start</span>()</h3>
<p>Starts the movie. <a href="qmovie.html">QMovie</a> will enter <a href="qmovie.html#MovieState-enum">Running</a> state, and start emitting <a href="qmovie.html#updated">updated</a>() and <a href="qmovie.html#resized">resized</a>() as the movie progresses.</p>
<p>If <a href="qmovie.html">QMovie</a> is in the <a href="qmovie.html#MovieState-enum">Paused</a> state, this function is equivalent to calling <a href="qmovie.html#setPaused">setPaused</a>(false). If <a href="qmovie.html">QMovie</a> is already in the <a href="qmovie.html#MovieState-enum">Running</a> state, this function does nothing.</p>
<p><b>See also </b><a href="qmovie.html#stop">stop</a>() and <a href="qmovie.html#setPaused">setPaused</a>().</p>
<!-- @@@start -->
<!-- $$$started[overload1]$$$started -->
<h3 class="fn" id="started"><a name="started"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">started</span>()</h3>
<p>This signal is emitted after <a href="qmovie.html#start">QMovie::start</a>() has been called, and <a href="qmovie.html">QMovie</a> has entered <a href="qmovie.html#MovieState-enum">QMovie::Running</a> state.</p>
<!-- @@@started -->
<!-- $$$stateChanged[overload1]$$$stateChangedQMovie::MovieState -->
<h3 class="fn" id="stateChanged"><a name="stateChanged"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">stateChanged</span>(<span class="type"><a href="qmovie.html#MovieState-enum">QMovie::MovieState</a></span> <i>state</i>)</h3>
<p>This signal is emitted every time the state of the movie changes. The new state is specified by <i>state</i>.</p>
<p><b>See also </b><a href="qmovie.html#state">QMovie::state</a>().</p>
<!-- @@@stateChanged -->
<!-- $$$stop[overload1]$$$stop -->
<h3 class="fn" id="stop"><a name="stop"></a><code>[slot] </code><span class="type">void</span> QMovie::<span class="name">stop</span>()</h3>
<p>Stops the movie. <a href="qmovie.html">QMovie</a> enters <a href="qmovie.html#MovieState-enum">NotRunning</a> state, and stops emitting <a href="qmovie.html#updated">updated</a>() and <a href="qmovie.html#resized">resized</a>(). If <a href="qmovie.html#start">start</a>() is called again, the movie will restart from the beginning.</p>
<p>If <a href="qmovie.html">QMovie</a> is already in the <a href="qmovie.html#MovieState-enum">NotRunning</a> state, this function does nothing.</p>
<p><b>See also </b><a href="qmovie.html#start">start</a>() and <a href="qmovie.html#setPaused">setPaused</a>().</p>
<!-- @@@stop -->
<!-- $$$updated[overload1]$$$updatedconstQRect& -->
<h3 class="fn" id="updated"><a name="updated"></a><code>[signal] </code><span class="type">void</span> QMovie::<span class="name">updated</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rect</i>)</h3>
<p>This signal is emitted when the rect <i>rect</i> in the current frame has been updated. You can call <a href="qmovie.html#currentImage">currentImage</a>() or <a href="qmovie.html#currentPixmap">currentPixmap</a>() to get a copy of the updated frame.</p>
<!-- @@@updated -->
<!-- $$$~QMovie[overload1]$$$~QMovie -->
<h3 class="fn" id="dtor.QMovie"><a name="dtor.QMovie"></a><code>[virtual] </code>QMovie::<span class="name">~QMovie</span>()</h3>
<p>Destructs the <a href="qmovie.html">QMovie</a> object.</p>
<!-- @@@~QMovie -->
<!-- $$$backgroundColor[overload1]$$$backgroundColor -->
<h3 class="fn" id="backgroundColor"><a name="backgroundColor"></a><span class="type"><a href="qcolor.html">QColor</a></span> QMovie::<span class="name">backgroundColor</span>() const</h3>
<p>Returns the background color of the movie. If no background color has been assigned, an invalid <a href="qcolor.html">QColor</a> is returned.</p>
<p><b>See also </b><a href="qmovie.html#setBackgroundColor">setBackgroundColor</a>().</p>
<!-- @@@backgroundColor -->
<!-- $$$currentFrameNumber[overload1]$$$currentFrameNumber -->
<h3 class="fn" id="currentFrameNumber"><a name="currentFrameNumber"></a><span class="type">int</span> QMovie::<span class="name">currentFrameNumber</span>() const</h3>
<p>Returns the sequence number of the current frame. The number of the first frame in the movie is 0.</p>
<!-- @@@currentFrameNumber -->
<!-- $$$currentImage[overload1]$$$currentImage -->
<h3 class="fn" id="currentImage"><a name="currentImage"></a><span class="type"><a href="qimage.html">QImage</a></span> QMovie::<span class="name">currentImage</span>() const</h3>
<p>Returns the current frame as a <a href="qimage.html">QImage</a>.</p>
<p><b>See also </b><a href="qmovie.html#currentPixmap">currentPixmap</a>() and <a href="qmovie.html#updated">updated</a>().</p>
<!-- @@@currentImage -->
<!-- $$$currentPixmap[overload1]$$$currentPixmap -->
<h3 class="fn" id="currentPixmap"><a name="currentPixmap"></a><span class="type"><a href="qpixmap.html">QPixmap</a></span> QMovie::<span class="name">currentPixmap</span>() const</h3>
<p>Returns the current frame as a <a href="qpixmap.html">QPixmap</a>.</p>
<p><b>See also </b><a href="qmovie.html#currentImage">currentImage</a>() and <a href="qmovie.html#updated">updated</a>().</p>
<!-- @@@currentPixmap -->
<!-- $$$device[overload1]$$$device -->
<h3 class="fn" id="device"><a name="device"></a><span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *QMovie::<span class="name">device</span>() const</h3>
<p>Returns the device <a href="qmovie.html">QMovie</a> reads image data from. If no device has currently been assigned, <code>nullptr</code> is returned.</p>
<p><b>See also </b><a href="qmovie.html#setDevice">setDevice</a>() and <a href="qmovie.html#fileName">fileName</a>().</p>
<!-- @@@device -->
<!-- $$$fileName[overload1]$$$fileName -->
<h3 class="fn" id="fileName"><a name="fileName"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QMovie::<span class="name">fileName</span>() const</h3>
<p>Returns the name of the file that <a href="qmovie.html">QMovie</a> reads image data from. If no file name has been assigned, or if the assigned device is not a file, an empty <a href="../qtcore/qstring.html">QString</a> is returned.</p>
<p><b>See also </b><a href="qmovie.html#setFileName">setFileName</a>() and <a href="qmovie.html#device">device</a>().</p>
<!-- @@@fileName -->
<!-- $$$format[overload1]$$$format -->
<h3 class="fn" id="format"><a name="format"></a><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QMovie::<span class="name">format</span>() const</h3>
<p>Returns the format that <a href="qmovie.html">QMovie</a> uses when decoding image data. If no format has been assigned, an empty QByteArray() is returned.</p>
<p><b>See also </b><a href="qmovie.html#setFormat">setFormat</a>().</p>
<!-- @@@format -->
<!-- $$$frameCount[overload1]$$$frameCount -->
<h3 class="fn" id="frameCount"><a name="frameCount"></a><span class="type">int</span> QMovie::<span class="name">frameCount</span>() const</h3>
<p>Returns the number of frames in the movie.</p>
<p>Certain animation formats do not support this feature, in which case 0 is returned.</p>
<!-- @@@frameCount -->
<!-- $$$frameRect[overload1]$$$frameRect -->
<h3 class="fn" id="frameRect"><a name="frameRect"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QMovie::<span class="name">frameRect</span>() const</h3>
<p>Returns the rect of the last frame. If no frame has yet been updated, an invalid <a href="../qtcore/qrect.html">QRect</a> is returned.</p>
<p><b>See also </b><a href="qmovie.html#currentImage">currentImage</a>() and <a href="qmovie.html#currentPixmap">currentPixmap</a>().</p>
<!-- @@@frameRect -->
<!-- $$$isValid[overload1]$$$isValid -->
<h3 class="fn" id="isValid"><a name="isValid"></a><span class="type">bool</span> QMovie::<span class="name">isValid</span>() const</h3>
<p>Returns <code>true</code> if the movie is valid (e.g&#x2e;, the image data is readable and the image format is supported); otherwise returns <code>false</code>.</p>
<p>For information about why the movie is not valid, see <a href="qmovie.html#lastError">lastError</a>().</p>
<!-- @@@isValid -->
<!-- $$$jumpToFrame[overload1]$$$jumpToFrameint -->
<h3 class="fn" id="jumpToFrame"><a name="jumpToFrame"></a><span class="type">bool</span> QMovie::<span class="name">jumpToFrame</span>(<span class="type">int</span> <i>frameNumber</i>)</h3>
<p>Jumps to frame number <i>frameNumber</i>. Returns <code>true</code> on success; otherwise returns <code>false</code>.</p>
<!-- @@@jumpToFrame -->
<!-- $$$lastError[overload1]$$$lastError -->
<h3 class="fn" id="lastError"><a name="lastError"></a><span class="type"><a href="qimagereader.html#ImageReaderError-enum">QImageReader::ImageReaderError</a></span> QMovie::<span class="name">lastError</span>() const</h3>
<p>Returns the most recent error that occurred while attempting to read image data.</p>
<p><b>See also </b><a href="qmovie.html#lastErrorString">lastErrorString</a>().</p>
<!-- @@@lastError -->
<!-- $$$lastErrorString[overload1]$$$lastErrorString -->
<h3 class="fn" id="lastErrorString"><a name="lastErrorString"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QMovie::<span class="name">lastErrorString</span>() const</h3>
<p>Returns a human-readable representation of the most recent error that occurred while attempting to read image data.</p>
<p><b>See also </b><a href="qmovie.html#lastError">lastError</a>().</p>
<!-- @@@lastErrorString -->
<!-- $$$loopCount[overload1]$$$loopCount -->
<h3 class="fn" id="loopCount"><a name="loopCount"></a><span class="type">int</span> QMovie::<span class="name">loopCount</span>() const</h3>
<p>Returns the number of times the movie will loop before it finishes. If the movie will only play once (no looping), loopCount returns 0. If the movie loops forever, loopCount returns -1.</p>
<p>Note that, if the image data comes from a sequential device (e.g&#x2e; a socket), <a href="qmovie.html">QMovie</a> can only loop the movie if the <a href="qmovie.html#cacheMode-prop">cacheMode</a> is set to <a href="qmovie.html#CacheMode-enum">QMovie::CacheAll</a>.</p>
<!-- @@@loopCount -->
<!-- $$$nextFrameDelay[overload1]$$$nextFrameDelay -->
<h3 class="fn" id="nextFrameDelay"><a name="nextFrameDelay"></a><span class="type">int</span> QMovie::<span class="name">nextFrameDelay</span>() const</h3>
<p>Returns the number of milliseconds <a href="qmovie.html">QMovie</a> will wait before updating the next frame in the animation.</p>
<!-- @@@nextFrameDelay -->
<!-- $$$scaledSize[overload1]$$$scaledSize -->
<h3 class="fn" id="scaledSize"><a name="scaledSize"></a><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QMovie::<span class="name">scaledSize</span>()</h3>
<p>Returns the scaled size of frames.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qmovie.html#setScaledSize">setScaledSize</a>() and <a href="qimagereader.html#scaledSize">QImageReader::scaledSize</a>().</p>
<!-- @@@scaledSize -->
<!-- $$$setBackgroundColor[overload1]$$$setBackgroundColorconstQColor& -->
<h3 class="fn" id="setBackgroundColor"><a name="setBackgroundColor"></a><span class="type">void</span> QMovie::<span class="name">setBackgroundColor</span>(const <span class="type"><a href="qcolor.html">QColor</a></span> &amp;<i>color</i>)</h3>
<p>For image formats that support it, this function sets the background color to <i>color</i>.</p>
<p><b>See also </b><a href="qmovie.html#backgroundColor">backgroundColor</a>().</p>
<!-- @@@setBackgroundColor -->
<!-- $$$setDevice[overload1]$$$setDeviceQIODevice* -->
<h3 class="fn" id="setDevice"><a name="setDevice"></a><span class="type">void</span> QMovie::<span class="name">setDevice</span>(<span class="type"><a href="../qtcore/qiodevice.html">QIODevice</a></span> *<i>device</i>)</h3>
<p>Sets the current device to <i>device</i>. <a href="qmovie.html">QMovie</a> will read image data from this device when the movie is running.</p>
<p><b>See also </b><a href="qmovie.html#device">device</a>() and <a href="qmovie.html#setFormat">setFormat</a>().</p>
<!-- @@@setDevice -->
<!-- $$$setFileName[overload1]$$$setFileNameconstQString& -->
<h3 class="fn" id="setFileName"><a name="setFileName"></a><span class="type">void</span> QMovie::<span class="name">setFileName</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>fileName</i>)</h3>
<p>Sets the name of the file that <a href="qmovie.html">QMovie</a> reads image data from, to <i>fileName</i>.</p>
<p><b>See also </b><a href="qmovie.html#fileName">fileName</a>(), <a href="qmovie.html#setDevice">setDevice</a>(), and <a href="qmovie.html#setFormat">setFormat</a>().</p>
<!-- @@@setFileName -->
<!-- $$$setFormat[overload1]$$$setFormatconstQByteArray& -->
<h3 class="fn" id="setFormat"><a name="setFormat"></a><span class="type">void</span> QMovie::<span class="name">setFormat</span>(const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &amp;<i>format</i>)</h3>
<p>Sets the format that <a href="qmovie.html">QMovie</a> will use when decoding image data, to <i>format</i>. By default, <a href="qmovie.html">QMovie</a> will attempt to guess the format of the image data.</p>
<p>You can call <a href="qmovie.html#supportedFormats">supportedFormats</a>() for the full list of formats <a href="qmovie.html">QMovie</a> supports.</p>
<p><b>See also </b><a href="qmovie.html#format">format</a>() and <a href="qimagereader.html#supportedImageFormats">QImageReader::supportedImageFormats</a>().</p>
<!-- @@@setFormat -->
<!-- $$$setScaledSize[overload1]$$$setScaledSizeconstQSize& -->
<h3 class="fn" id="setScaledSize"><a name="setScaledSize"></a><span class="type">void</span> QMovie::<span class="name">setScaledSize</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &amp;<i>size</i>)</h3>
<p>Sets the scaled frame size to <i>size</i>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qmovie.html#scaledSize">scaledSize</a>() and <a href="qimagereader.html#setScaledSize">QImageReader::setScaledSize</a>().</p>
<!-- @@@setScaledSize -->
<!-- $$$state[overload1]$$$state -->
<h3 class="fn" id="state"><a name="state"></a><span class="type"><a href="qmovie.html#MovieState-enum">QMovie::MovieState</a></span> QMovie::<span class="name">state</span>() const</h3>
<p>Returns the current state of <a href="qmovie.html">QMovie</a>.</p>
<p><b>See also </b><a href="qmovie.html#MovieState-enum">MovieState</a> and <a href="qmovie.html#stateChanged">stateChanged</a>().</p>
<!-- @@@state -->
<!-- $$$supportedFormats[overload1]$$$supportedFormats -->
<h3 class="fn" id="supportedFormats"><a name="supportedFormats"></a><code>[static] </code><span class="type">QList</span>&lt;<span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span>&gt; QMovie::<span class="name">supportedFormats</span>()</h3>
<p>Returns the list of image formats supported by <a href="qmovie.html">QMovie</a>.</p>
<p>This function was introduced in Qt 4.1.</p>
<p><b>See also </b><a href="qimagereader.html#supportedImageFormats">QImageReader::supportedImageFormats</a>().</p>
<!-- @@@supportedFormats -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
